image = imread("../images/coins.png");

image = rgb2gray(image);

level = graythresh(image);

BW = imbinarize(image,level);

imshowpair(image,BW,'montage');